# -*- coding: utf-8 -*-
# @Time: 2024/9/5 9:30
# @Author: foxhuty
# @File: main.py
# @Software: PyCharm
# @Based on python 3.10
from newgaokao import NewGaokaoData
import sys


class MyException(object):
    def __init__(self, obj_data):
        self.obj_data = obj_data
        import traceback
        import logging
        logging.basicConfig(
            level=logging.DEBUG,
            filename='D:\\my_logging\\error.log',
            format='%(asctime)s %(levelname)s\n %(message)s',
            datefmt='%Y-%m-%d %H:%M:%S'
        )
        logging.error(traceback.format_exc())
        logging.info(msg=self.obj_data)


@NewGaokaoData.time_use
def main(file):
    try:
        new_gaokao = NewGaokaoData(file)
        new_gaokao.excel_files()
        MyException(new_gaokao)

    except Exception as e:
        print(f"An error occurred: {e}", file=sys.stderr)


if __name__ == '__main__':
    # file_path = r'D:\data_test\高2026级学生10月考成绩汇总.xlsx'
    file_path = r'D:\data_test\高2022级零诊成绩测试数据.xlsx'
    #不分科的各科有效分
    NewGaokaoData.subjects_good_scores_all = [80, 60, 80, 40, 50, 40, 40, 50, 40, 400]
    #物理类各科有效分
    NewGaokaoData.subjects_good_scores_physics = [80, 60, 80, 40, 40, 40, 50, 40, 380]
    #历史类各科有效分
    NewGaokaoData.subjects_good_scores_history = [80, 60, 80, 50, 40, 40, 50, 400]

    #运行主函数main
    main(file_path)
